<template>
  <a-modal
    :title="title"
    :visible="visible"
    cancelText="关闭"
    :closable="true"
    @cancel="handleCancel"
    :confirmLoading="confirmLoading"
    wrapClassName="ant-modal-cust-warp"
    style="top:5%;overflow-y: hidden"
    :width="600"
    :footer="null"
  >
    <div>
      <a-row v-for="(item,index) in tasks" :key="'item'+index" style="margin-top: 10px">
        <span class="dot"></span>
        <span :title="item.userName">{{item.userName}}在{{item.createTime}}申请了一个{{item.remark}}的{{item.modelName}}</span>
        <a style="margin-left: 10px" @click="close()">
          <router-link :to="{ path: path }"><img class="tag" src="../../../img/daiban1.png"></router-link>
        </a>
      </a-row>
    </div>
  </a-modal>
</template>

<script>
  import pick from 'lodash.pick'
  import {getTodos} from '@/api/home.js'
  import{getTodoTaskList} from '@/api/activiti'
  import{getAnnouncementList} from '@/api/api'

  export default {
    data() {
      return {
        title: '待办事项',
        showTableHeader: true,
        visible: false,
        confirmLoading: false,
        form: this.$form.createForm(this),
        tableData: [],
        tasks:[],
        path: '/flow/taskList'

      }
    },
    created() {
      this.fetchData()
    },
    methods: {
      fetchData() {
        let that = this
        that.loadTask()
        let data = {
          total: 20,
          content: [{
            id: 1,
            user: '马达芸',
            type: 1,
            name: '10点30分于810室召开关于科室4月工作例会',
            content: '10点30分于810室召开关于科室4月工作例会',
            percent: 45,
            icon: 'car',
            tag: '待办',
            read: true,
            imageUrl: 'images/index/ship.png',
            date: '12-07',
            unreadCount: 3,
            time: '11:30'
          }
          ]
        }
      },
      show() {
        this.visible = true
        },
      loadTask() {
        const vm = this
        getTodoTaskList().then(res => {
          vm.tasks = [].concat(res.result.records).slice(0,20)

        })
      },
      close() {
        this.$emit('close')
        this.visible = false
      },
      handleCancel() {
        this.close()
      }
    }
  }
</script>
<style scoped>
  .rightAngle {
    border-radius: 0px 0px 0px 0px;
  }
  .dot {
    background-image:url("../../../img/xuhao.png");
    height: 6px;
    width: 6px;
    display: inline-block;
    position: relative;
    margin-left: 15px;
    top: -2px;
  }
  .tag{
    width: 80px;
    height:25px;
  }

</style>